package com.APISecond.ArraysOrder;

import java.util.Arrays;
import java.util.function.IntToDoubleFunction;

public class Arrays_ {
        public static void main(String[] args) {
            //返回数组中的内容
            int[]arr={11,23,24,34,54,65};
            System.out.println(Arrays.toString(arr));
            //拷贝指定范围内的数组
            int[]arr2=Arrays.copyOfRange(arr,0,3);
            System.out.println(Arrays.toString(arr2));
            //拷贝数组指定数组的长度
            int[]arr3=Arrays.copyOf(arr,15);
            System.out.println(Arrays.toString(arr3));
            //把数组中的原数组拷贝为新数组有存起来。
            double[]prices={99.8,128,100};
            Arrays.setAll(prices, new IntToDoubleFunction() {
                @Override
                public double applyAsDouble(int value) {
                    return prices[value]*0.8;
                }
            });
            System.out.println(Arrays.toString(prices));
            //升序进行排列  数字类型
            Arrays.sort(prices);
            System.out.println(Arrays.toString(prices));
            //对象的排序

        }
    }

